Harden environment variable and secrets management#123
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Reviews and hardens how Task-Bounty manages environment variables so secrets are not committed, leaked to the browser, or left in example templates.
The active app is Stellar/Soroban + Next.js. Configuration previously lived as hardcoded Horizon/network values, with a legacy EVM
.env.examplethat looked like it expected real private keys and API slots. This PR adds safe templates, clearer gitignore rules, public-only env wiring with defaults, and documentation that spells out what must never be committed.Acceptance criteria
.env.exampleupdatedWhat changed
Env templates
frontend/.env.examplefor the active Next.js app (public config only).env.examplepointing contributors at the correct workspace filesDocuments/Task Bounty/.env.example:PRIVATE_KEY/ API key fields emptySecret exposure controls
.env,.env.*,.env.local.env.examplevia!.env.exampleNEXT_PUBLIC_*values are browser-visible and must never hold secretsRuntime config (behavior preserved)
frontend/src/lib/env.tswithgetPublicEnv():NEXT_PUBLIC_STELLAR_NETWORK(defaultPUBLIC)NEXT_PUBLIC_HORIZON_URL(defaulthttps://horizon.stellar.org)NEXT_PUBLIC_SOROBAN_RPC_URL/NEXT_PUBLIC_CONTRACT_IDfrontend/src/lib/stellar.ts→ Horizon URL from envfrontend/src/hooks/stellar-wallets-kit.ts→ network from env.env.localrequiredDocumentation
ENVIRONMENT.md— rules, variable table, local setup, deploy-secret guidanceSECURITY.md,SETUP.md, andfrontend/README.mdTests
frontend/src/lib/env.test.ts:.env.examplefiles have no sensitive-looking assignmentsSecurity notes
NEXT_PUBLIC_*S…), EVM private keys, API tokens, mnemonicsTest plan
cd frontend && pnpm test— 45 passed (includes env template checks)cd frontend && pnpm build— succeeds without.env.localcd frontend && pnpm lint— 0 errorsgit check-ignore -q frontend/.env.local— ignoredgit check-ignore -q frontend/.env.example— not ignored (trackable)Follow-ups (out of scope)
closes #36